package top.mable.rabbitmq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author taffywen
 * @date 2022/7/24 22:28
 */
//@Configuration
public class DeadLetterConfig {

    @Bean
    public TopicExchange printTopicExchange(){


        return new TopicExchange("dead_direct_exchange",true,false);
    }


    @Bean
    public Queue printQueue(){
        return new Queue("dead.direct.queue",true,false,false);
    }

    @Bean
    public Binding printBinding(){
        return BindingBuilder.bind(printQueue()).to(printTopicExchange()).with("dead-key");
    }
}